﻿using Microsoft.Extensions.Logging;
using SingleBlog.Core.Services;
using System;

namespace SingleBlog.Framework.Logger
{
    public class BlogLoggerProvider:ILoggerProvider
    {
        private readonly IServiceProvider _serviceProvider;
        private Func<LogLevel, bool> _filter;
        public BlogLoggerProvider(IServiceProvider serviceProvider, Func<LogLevel, bool> filter =default(Func<LogLevel, bool>))
        {
            _serviceProvider = serviceProvider;
            _filter = filter;
        }

        public ILogger CreateLogger(string categoryName) 
            => new BlogLogger<string>(categoryName, _serviceProvider, _filter);
        public void Dispose() { }
    }
}
